from django.db import models


# Create your models here.
class Person(models.Model):
    id = models.AutoField(primary_key=True)
    first_name = models.CharField(max_length=20)
    last_name = models.CharField(max_length=20)
    age = models.IntegerField('Person age')

    def stand_up(self):
        return '{} can stand up!'.format(self.last_name)


class Address(models.Model):
    """
    many to one example
    """
    id = models.AutoField(primary_key=True)
    city = models.CharField(max_length=20)
    street = models.CharField(max_length=20)
    person = models.ForeignKey(Person, on_delete=models.DO_NOTHING)
